/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project1;

import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JPanel;

/**
 *
 * @author maciej
 */
public class ScenePanel extends JPanel{
    ArrayList<Line2D> lines = new ArrayList<Line2D>();
    public void setLines(ArrayList<Line2D> l){
        lines.clear();
        lines.addAll(l);
    }
    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        Point2D p1, p2;
        for (Line2D temp : lines) {
            p1 = temp.getPoint(0);
            p2 = temp.getPoint(1);
            g.drawLine(
                    p1.getX(), p1.getY(),
                    p2.getX(), p2.getY()
                    );
        } 
    }
    
}
